<?php
/**
 * Created by PhpStorm.
 * User: denh
 * Date: 16/8/1
 * Time: 下午5:20
 */
class BsChat {

    function format_data($received_text) {
        $tst_msg = json_decode($received_text); //json decode
        $user_userid = $tst_msg->userid; //sender name
        $user_headpic = $tst_msg->headpic; //message text
        $user_username = $tst_msg->username; //message text
        $user_课程id = $tst_msg->课程id; //message text
        $user_message = $tst_msg->message;
        $user_serverId = $tst_msg->serverId; //message text
        $user_群id = $tst_msg->群id; //message text
        $user_地址 = $tst_msg->地址; //message text

        $response_text = json_encode(array('type'=>'usermsg', 'userid'=>$user_userid,'message'=>$user_message, 'headpic'=>$user_headpic,'username'=>$user_username, '群id'=>$user_群id,'课程id'=>$user_课程id,'serverId'=>$user_serverId,'地址'=>$user_地址));
        return $response_text;
    }
}